package com.shopping.mall.core.module.instrumentPanel.controller;

import com.shopping.mall.auth.annotation.UnLogin;
import com.shopping.mall.base.http.Result;
import com.shopping.mall.core.module.instrumentPanel.entity.OrderNum;
import com.shopping.mall.core.module.instrumentPanel.entity.PayNum;
import com.shopping.mall.core.module.instrumentPanel.entity.UserNum;
import com.shopping.mall.core.module.instrumentPanel.entity.VisitNum;
import com.shopping.mall.core.module.instrumentPanel.service.InstrumentPanelService;
import com.shopping.mall.core.module.order.entity.Order;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;

@Api(tags = "仪表盘")
@RestController
@RequestMapping("/panel")
public class InstrumentPanelController {
    @Autowired
    private InstrumentPanelService instrumentPanelService;

    @UnLogin
    @GetMapping
    @ApiOperation("查询仪表盘")
    public Result<Object> getOrderNum() throws ParseException {
        OrderNum orderNum=instrumentPanelService.getOrderNum();
        VisitNum visitNum=instrumentPanelService.getAllVisitNum();
        PayNum payNum=instrumentPanelService.getPrice();
        UserNum userNum=instrumentPanelService.getUserNum();
        Map<String, Object> data=new HashMap<>();
        data.put("orderNum",orderNum);
        data.put("visitNum",visitNum);
        data.put("payNum",payNum);
        data.put("userNum",userNum);
        return Result.OK(data);
    }



}
